Char()

String Function

Syntax samples

CHAR(<expression>)

CHAR(10)

Description

Returns the ASCII character for the number that the expression evaluates to. This function is most useful for outputting ASCII characters that cannot be typed, such as accented characters. This function is most often used in conjunction with a string expression and the concatenation ("$") operator.

The number corresponding to the ASCII character varies with each computer depending on the character set specified in the config.sys file of your computer. To determine the number corresponding to the ASCII character at your computer, run the model CHAR.MOD found in the MODELS\REFS directory. View the file this model generates called CHAR.TXT found in the same directory as the model.

Valid In

Any string expression.

Components

<expression>

Any expression that evaluates to a number between 0 and 255. The expression is evaluated every time the CHAR() function is encountered.

Example

The logic below displays the combined cost of all the Parts ordered through a particular service center. The simulation has kept a tally of all the parts it has ordered in the variable Parts, and each part cost 25 English pounds. The logic displays the cost of the parts with the pound symbol (£), which is ASCII code 163.

DISPLAY "Total cost of parts:" $ CHAR(163) $ Parts * 25

 

 

See Also

String Expressions.